package com.dayang.homemaking.common.module.desensitization;

import cn.hutool.core.util.DesensitizedUtil;
import cn.hutool.core.util.StrUtil;

/**
 * @author: dayang
 * @since: 2024/9/18
 * @description: 脱敏策略枚举
 */
public enum DesensitizationTypeEnum {
    CUSTOMER {
        @Override
        public String desensitize(String str, int startInclude, int endExclude) {
            return StrUtil.hide(str,startInclude,endExclude);
        }
    },
    PHONE {
        @Override
        public String desensitize(String str, int startInclude, int endExclude) {
            return DesensitizedUtil.mobilePhone(str);
        }
    },
    EMAIL {
        @Override
        public String desensitize(String str, int startInclude, int endExclude) {
            return DesensitizedUtil.email(str);
        }
    };

    public abstract String desensitize(String str, int startInclude, int endExclude);
}
